#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
#include<algorithm>
#include<map>
using namespace std;
struct TreeNode {
	int val;
	TreeNode* left;
	TreeNode* right;
	TreeNode() : val(0), left(nullptr), right(nullptr) {}
	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
	TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left), right(right) {}
};
//unordered_map<int, int> index;
//TreeNode* _buildTree(vector<int>& preorder, vector<int>& inorder,int preleft,int preright,int inleft,int inright) {
//	if (preleft > preright)
//		return nullptr;
//	TreeNode* root = new TreeNode(preorder[preleft]);
//	int inroot = index[preorder[preleft]];
//	int len = inroot - preleft + 1;
//	root->left = _buildTree(preorder, inorder, preleft + 1, preleft + len - 1, inleft, inroot - 1);
//	root->right = _buildTree(preorder, inorder, preleft + len, preright, inroot + 1, inright);
//	return root;
//}
//TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
//	int n = preorder.size();
//	for (int i = 0; i < n; i++)
//		index[inorder[i]] = i;
//	return _buildTree(preorder, inorder, 0, n - 1, 0, n - 1);
//}
//vector<int> ret;
//void _inorderTraversal(TreeNode* root) {
//	if (root == nullptr)
//		return;
//	_inorderTraversal(root->left);
//	ret.push_back(root->val);
//	_inorderTraversal(root->right);
//}
//vector<int> inorderTraversal(TreeNode* root) {
//	_inorderTraversal(root);
//	return ret;
//}
//vector<int> ret;
//void _postorderTraversal(TreeNode* root) {
//	if (root == nullptr)
//		return;
//	_postorderTraversal(root->left);
//	_postorderTraversal(root->right);
//	ret.push_back(root->val);
//}
//vector<int> postorderTraversal(TreeNode* root) {
//	_postorderTraversal(root);
//	return ret;
//}
struct cmp
{
	bool operator()(const pair<string,int>& x, const pair<string, int>& y)
	{
		if (x.second == y.second)
			return x.first < y.first;
		else
			return x.second > y.second;
	}
};
int main()
{
	string s;
	getline(cin, s);
	map<string, int> hash;
	int left=0,right=0;
	string tmp;
	while (right != string::npos)
	{
		right = s.find_first_of(' ', left);
		tmp = s.substr(left, right - left + 1);
		for (int i = 0; i < tmp.size(); i++)
		{
			if (tmp[i] == '.')
				tmp.pop_back();
			else
			tmp[i] = tolower(tmp[i]);
		}
		hash[tmp]++;
		left = right + 1;
	}
	vector<pair<string, int>> v(hash.begin(), hash.end());
	stable_sort(v.begin(), v.end(), cmp());
	for (auto& [a, b] : v)
	{
		cout << a << ':' << b << endl;
	}
	return 0;
}